package com.htgd.gardenexpo.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.htgd.gardenexpo.entity.WxUser;
import com.htgd.gardenexpo.page.WxUserQuery;
import com.htgd.gardenexpo.vo.UserNumVO;
import com.htgd.gardenexpo.vo.WxUserVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface WxUserDao extends BaseMapper<WxUser> {
    List<WxUserVO> querylist(WxUserQuery wxUserQuery);

    UserNumVO getNum(String openId);

    void updateCarbonNumAdd(@Param("num") Integer num, @Param("openId")String openId);

    void updateIntegralNumAdd(@Param("num") Integer num, @Param("openId")String openId);

    @Select("SELECT COUNT(1) FROM wx_user WHERE DATE(create_time) = #{date}")
    Long getNumByDate(@Param("date") String date);
    Long getFaceNums(@Param("startTime") String startTime, @Param("endTime") String endTime);

    List<Map<String, Object>> getPhoneCityNums();
    @Select("SELECT deck_id FROM wx_user WHERE open_id= #{openId}")
    String getDeckId(@Param("openId") String openId);
    @Select("SELECT open_id FROM wx_user WHERE deck_id= #{deckId}")
    String getOpenId(@Param("deckId") String deckId);
    @Select("SELECT * FROM wx_user WHERE open_id= #{openId}")
    WxUser getByOpenId(@Param("openId") String openId);
    @Select("SELECT * FROM wx_user WHERE deck_id= #{deckId}")
    WxUser getByDeckId(@Param("deckId") String deckId);
}
